﻿using System.Collections.ObjectModel;


namespace ThePresenter
{
	public class SlidesCollection : ObservableCollection<Slide>
	{
		#region Methods
		/// <summary>
		/// Swaps the slide A with B.
		/// </summary>
		/// <param name="a">The A slide.</param>
		/// <param name="b">The B slide.</param>
		/// <exception cref="System.IndexOutOfRangeException"/>
		public void Swap(Slide a, Slide b)
		{
			Swap(IndexOf(a), IndexOf(b));
		}

		/// <summary>
		/// Swaps the slide A with B.
		/// </summary>
		/// <param name="a">Index of the A slide.</param>
		/// <param name="b">Index of the B slide.</param>
		/// <exception cref="System.IndexOutOfRangeException"/>
		public void Swap(int a, int b)
		{
			lock (this)
			{
				Slide s = this[b];

				this[b] = this[a];
				this[a] = s;
			}
		}
		#endregion
	}
}
